//admin client session
$(function(){
	clientsession.run();
});

var clientsession = {
		run: function(){
			this._init_();
			this._start_();
			this._init_events();			
		},
		
		_init_: function(){			
			this.$agent = $("#agent");
			this.agent = this.$agent.val() || '';
			this.contextPath = $("#contextPath").val() || "";
		},
		
		_start_: function(){
			this._list_client_session();
		},
		
		_init_events: function(){
			this.$agent.change(function(){
				clientsession.agent = clientsession.$agent.val();
				clientsession._list_client_session();
			});
		},
		
		_list_client_session: function(){
			var url = this.contextPath + "/admin/clientsession/list?agent=" + this.agent;
			$.get(url, function(result){
				$("#session_list_div").html(result);
				$("#total_td").text($("#total").val());
				$("#totalCount").html($("#inputTotal").val());
			});
		}
};